<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/global/global-head.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>吉车惠后台管理系统</title>
    <%@include file="/global/global-other.jsp" %>
    <script type="text/javascript">
        var $bn_shop_map = new Object();
        $(function() {

            submitForm = function( $dialog, $gird){
                $('#bn_shop_form').form('submit',{
                    url:'${ctx}/bn/hot/shop/insert',
                    queryParams:{_m:'exec'},
                    onSubmit:function(){
                        if($(this).form('enableValidation').form('validate')){
                            return true;
                        }else{
                            return false;
                        }
                    },
                    success:function(data){
                        var json =  eval("(" +data+ ")");
                        if(statusMsg(json)){
                            parent.$.messager.alert("提示","保存成功！","info",function(){
                                $dialog.dialog('destroy');
                                $gird.datagrid('reload');
                            });
                        }
                    }
                });
            };


            var viewDialog ;
            //店铺选择
            shopSave = function(){
                viewDialog = parent.$.dialog({
                    title: '<i class="fa fa-th-large"></i><span class="dialog-title">&nbsp;选取店铺<span>',
                    href: '${ctx}/bn/hot/shop/insert?_m=shopquery&r='+Math.random(),
                    width: 800,
                    height: 500,
                    modal: true,
                    onClose : function() {
                        $(this).dialog('destroy');
                    },
                    buttons: [{
                        text:'<i class="fa fa-floppy-o" aria-hidden="true"></i>&nbsp;选 择',
                        width:'70px',
                        handler: function(){
                            var json = viewDialog.find('iframe').get(0).contentWindow.chooseShop();
                            $("#shopId").val(json.shopId);
                            $("#mediumPic").val(json.mediumPic);
                            $("#shopName").val(json.shopName);
                            $("#shopShortName").val(json.shopShortName);

                            viewDialog.dialog('destroy');
                        }
                    },{
                        text:'<i class="fa fa-reply" aria-hidden="true"></i>&nbsp;返 回',
                        width:'70px',
                        handler: function(){
                            viewDialog.dialog('destroy');
                        }
                    }]
                });
            }


        });

    </script>
</head>
<body>
<div class="form-box">
    <div class="form-body">
        <form role="form" method="POST" name="bn_shop_form" id="bn_shop_form" class="easyui-form form form-horizontal" data-options="novalidate:true">
            <input type="hidden" id="shopId" name="shopId" value=""/>
            <input type="hidden" id="mediumPic" name="mediumPic" value=""/>
            <div class="seg-title">
                <div class="seg-title-box">
                    <ul>
                        <li class="seg-title-box-icon" ><img src="${ctx }/assets/images/communication.gif"/></li>
                        <li class="seg-title-box-text">基本信息</li>
                    </ul>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">
                    <p class="label-txt">店铺名称：</p>
                    <p class="star">*</p>
                </label>
                <div class="col-sm-8">
                    <input type="text" id="shopName" name="shopName"  onclick="shopSave()" class="form-control easyui-validatebox" style="cursor: pointer;width:100%;height:34px;line-height:34px;" required="required" data-options="editable:false" validType="length[1,50]">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">
                    <p class="label-txt">店铺简称：</p>
                    <p class="star">*</p>
                </label>
                <div class="col-sm-8">
                    <input type="text" id="shopShortName" name="shopShortName" onclick="shopSave()" class="form-control easyui-validatebox" style="cursor: pointer;width:100%;height:34px;line-height:34px;" data-options="editable:false" required="required" validType="length[1,50]">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">
                    <p class="label-txt">排序：</p>
                    <p class="star">*</p>
                </label>
                <div class="col-sm-3">
                    <input type="text" id="seq" name="seq" value="1"  class="form-control easyui-validatebox" style="width:100%;height:34px;line-height:34px;" required="required" validType="number">
                </div>
            </div>
        </form>
        <div style="padding-top:50px;"></div>
    </div>
</div>
</body>
</html>